import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from "@/views/Index"
import WorldData from "@/views/WorldData"
import ChinaData from "@/views/ChinaData"
import TopChart from "@/views/TopChart"

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: '疫情数据',
        component: Index,
        redirect: '/chinaData',
        children: [
            {
                path: '/chinaData',
                name: '大陆疫情',
                component: ChinaData
            },
            {
                path: '/worldData',
                name: '世界疫情',
                component: WorldData
            }
        ]
    },
    {
        path: '/navigation',
        name: '图表',
        component: Index,
        children: [
            {
                path: '/topChart',
                name: '累计确诊TOP10',
                component: TopChart
            }
        ]
    }

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
